package com.just.fun.thread;

public class SyncTest {
    public static void main(String[] args) throws InterruptedException {
        SyncBase test = new SyncBase();
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    test.m1();
                    Thread.sleep(5000);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                System.out.println("线程1执行完毕");
            }
        });

        t1.start();

        Thread.sleep(1000);
        System.out.println("线程1执行1秒后");
        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("线程2开始执行");
                test.m1();
            }
        });

        t2.start();

    }

}
